package com.java.oop;

/**
 * 人类
 */
public abstract class Human {

    public Human(){
        System.out.println("Human构造方法");
    }
    /**
     * 抽象方法
     */
    public abstract void eat();

    public static void main(String[] args) {
//        Human human = new Human();
//        Chinese chinese = new Chinese();
//        American american = new American();
//        Indian indian = new Indian();
//        chinese.eat();
//        american.eat();
//        indian.eat();
        //多态：父类 ——> 子类对象
        Human man = new Indian();
        man.eat();
    }
}
//中国人 重写eat方法
class Chinese extends Human{
    public void eat(){
        System.out.println("中国人用筷子吃饭了");
    }
}
class American extends Human{
    public void eat(){
        System.out.println("美国人用刀叉吃饭了");
    }
}
class Indian extends Human{
    public void eat(){
        System.out.println("印度人用手吃饭了");
    }
}

